package xc.com.elasticsearch.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import xc.com.course.domain.CoursePub;
import xc.com.elasticsearch.mapper.CourseSearchParam;
import xc.com.elasticsearch.mapper.QueryResponseResult;
import xc.com.elasticsearch.service.ESCourseService;

@RequestMapping("/es")
@RestController
@CrossOrigin
public class ESCourseController {

    @Autowired
    private ESCourseService esCourseService;

    /**
     * es搜索框
     * @param page
     * @param size
     * @param courseSearchParam
     * @return
     */
    @GetMapping("/findByList/{page}/{size}")
    public QueryResponseResult<CoursePub> findByList(@PathVariable("page") Integer page,@PathVariable("size") Integer size,@RequestBody CourseSearchParam courseSearchParam){
        return esCourseService.findByList(page,size,courseSearchParam);
    }

}
